UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yxKm8PQhsmay7VvZGZnTlbOcLTRfyAdPB8TzOCUKABU='
WHERE
key_id = '6cf27ede61e4005be9f8e384d07a5c8e8167c1a023b6e7cf55936a8ae38852cc'
AND (
token = 'yxKm8PQhsmay7VvZGZnTlbOcLTRfyAdPB8TzOCUKABU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)