UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KL8KyicXTCSmtz+x+raaqYpCy5SZhfgvoHCBUAFT6Bo='
WHERE
key_id = '0680c19cf6858313af1cec9a86377cfdcd34f298396bcc5c2be1c5bac7ea90f9'
AND (
token = 'KL8KyicXTCSmtz+x+raaqYpCy5SZhfgvoHCBUAFT6Bo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)