UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dEW38tvXCntYV8FCch0aPh/pPJLLSumrqd8Q7NuP7JE='
WHERE
key_id = 'e3f9f443729a2284ade09ba730a0ad0978b7b3e72166150e5e7c6ef62d7a364a'
AND (
token = 'dEW38tvXCntYV8FCch0aPh/pPJLLSumrqd8Q7NuP7JE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)