UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tH5MiysEVbYTWsL++JDbfNdaXV7yTTmdxS1B13KkvmU='
WHERE
key_id = 'b65264187653f0796a91ea67d226da9f962d41fc07d486e67105b4cf334ff3bc'
AND (
token = 'tH5MiysEVbYTWsL++JDbfNdaXV7yTTmdxS1B13KkvmU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)