UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FaAZj2jkx0JbOUoeChe7YG+Fq1Z0lz2cnVkN2Bw3HS8='
WHERE
key_id = 'a6b754b81f608d3079baea5c2bc940ddcd7a3c601c2b4d9504f9ad54d5421982'
AND (
token = 'FaAZj2jkx0JbOUoeChe7YG+Fq1Z0lz2cnVkN2Bw3HS8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)