UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NfcJYo4m4ECPY+yYiFaZ4rsgdz5ESv9M4lLIR9EYMh0='
WHERE
key_id = '8b11268884415c66290f562c41271070e05bc0231d5e0f9e65cc7b0f3a508090'
AND (
token = 'NfcJYo4m4ECPY+yYiFaZ4rsgdz5ESv9M4lLIR9EYMh0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)