UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lqepy3QZ2te1baRxfPyvEp6tNIhZvUhRMy0oc24BTzM='
WHERE
key_id = '178bc766a798af1e127092fb1e1f050e432a4c20333d292c85a1f6c0628b033a'
AND (
token = 'lqepy3QZ2te1baRxfPyvEp6tNIhZvUhRMy0oc24BTzM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)