UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V14xqGNALMuwgzxeY9z9RnWaa3N4xIjk107rOECH5zg='
WHERE
key_id = 'a5829ed11a41fd3a9f778f913c159a7c0da28c988ac8957abffee83d712cfd13'
AND (
token = 'V14xqGNALMuwgzxeY9z9RnWaa3N4xIjk107rOECH5zg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)