UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mSQckQ3k0JEhlBxIbGIysnVYJ1UgGCmyX0j09CMO1TU='
WHERE
key_id = '8ad19e73e6d3ce6fbe7391b7e819529a31666e4811a1bbd06054a3da27b0b229'
AND (
token = 'mSQckQ3k0JEhlBxIbGIysnVYJ1UgGCmyX0j09CMO1TU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)