UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P64Gq3PL39LrfTJNdBna3PGNCmHrC7/2OTSp0YSoP9k='
WHERE
key_id = 'a8692b1d8e4c7141bf23069f5ed9fe63003e5df475ff0772224b129e3290bb44'
AND (
token = 'P64Gq3PL39LrfTJNdBna3PGNCmHrC7/2OTSp0YSoP9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)