UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'shETnyhwLKf51EejpB3AjS4U0ccEcXNHHLFK/An++kM='
WHERE
key_id = 'd9403865849c3f97f23d6f7d62176697e62728f35804189aa044aaf9976cef57'
AND (
token = 'shETnyhwLKf51EejpB3AjS4U0ccEcXNHHLFK/An++kM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)