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