UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'esquHIfy0uogCbaekUmRf/X5KettXNNGygF91TflodA='
WHERE
key_id = '48da0ce9e0b83b7b1e62d7e35f09c909436253be7e767b9ca6448bc044ba286d'
AND (
token = 'esquHIfy0uogCbaekUmRf/X5KettXNNGygF91TflodA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)