UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YrZkMt2GcdEkYLWX6pAIvBMfCFmAUMoYXpoQaTBLj3o='
WHERE
key_id = '64bcb39f70bda0dcc90373616d6f137fe6cc0b94d76ed23747a79b09cf4cd464'
AND (
token = 'YrZkMt2GcdEkYLWX6pAIvBMfCFmAUMoYXpoQaTBLj3o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)