UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gM4wTNUXpE/k/ehpHKvdBSXQwqbftdipyNqKmvbPws0='
WHERE
key_id = '2eda231ac9e26eda1a93d8c329263a8ced2716068b81695a9b5f653d4b3598d9'
AND (
token = 'gM4wTNUXpE/k/ehpHKvdBSXQwqbftdipyNqKmvbPws0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)