UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bWiPrCIIh4jgDPwXDOb4VmhIF5POhM2Bd74UkftSiW8='
WHERE
key_id = 'cd77bf8baf8f8432d7492b414d7e3b3b56b83bc097a2acbe39a18bd68b5a4efb'
AND (
token = 'bWiPrCIIh4jgDPwXDOb4VmhIF5POhM2Bd74UkftSiW8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)