UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dCG5HlyMhDFlmWeDlAt8U0bRf6jamDoJ34pZWwfltqE='
WHERE
key_id = '9b51cc13abd3ffe9ecdbd6e958b26c31d06131c69c0843e929e0b0719dfae2f8'
AND (
token = 'dCG5HlyMhDFlmWeDlAt8U0bRf6jamDoJ34pZWwfltqE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)