UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qN2vfXt/TMXzKMyRigCAJyx+9m3FpVy8UXpMb9Qr6u0='
WHERE
key_id = 'c66e71927ce27b3399fdebc985f76900aa1e6f31b36ba2b9cdbda6309d589877'
AND (
token = 'qN2vfXt/TMXzKMyRigCAJyx+9m3FpVy8UXpMb9Qr6u0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)