UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TnBmGltliLz7DwJUQa0m+/haZK/UpykKW6psW1N8fIs='
WHERE
key_id = 'f14f5a07ff22f44c495a5593ff8f4ef663cdcedf0d4b4c54bb5362df45c035d5'
AND (
token = 'TnBmGltliLz7DwJUQa0m+/haZK/UpykKW6psW1N8fIs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)