UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4rb3R67Oc1WX4isE1sGZ+C2LppgSW4BExc2xqaIKRgY='
WHERE
key_id = 'e8a3ad550c2dfbe3441315aca260c879ddeafb9aef704618414a500038c6f838'
AND (
token = '4rb3R67Oc1WX4isE1sGZ+C2LppgSW4BExc2xqaIKRgY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)