UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZcZ5nc5G5sN4+ddpik/POeg8HCjwv0gWGU86vIbcS1o='
WHERE
key_id = '709fd9bc986b57498933ee1f8ec9064c3d7177c2a129f7f7f917de3ebdcb3b7d'
AND (
token = 'ZcZ5nc5G5sN4+ddpik/POeg8HCjwv0gWGU86vIbcS1o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)