UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kw0nrkWPgLGdPF3snhMjGyQRPjN7QV5PsWle90LHHUE='
WHERE
key_id = '8e723c95a6c2a67bebfe4cc4703b7a5f197bbceae9b8e472623e2fbdfcd8d20b'
AND (
token = 'kw0nrkWPgLGdPF3snhMjGyQRPjN7QV5PsWle90LHHUE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)