UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M76MzR5R9rNdFvc26Mi3fXBUp4rs8n77IYgOUACzqUQ='
WHERE
key_id = 'f8083e6efa25f6fb43130b287dc9ea8d146763dd0a6d6eb368bab57903b8dcc1'
AND (
token = 'M76MzR5R9rNdFvc26Mi3fXBUp4rs8n77IYgOUACzqUQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)