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