UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FfnTXAXvhHu5fcQtT+6vJ+mdQERoole2WYKdLLvF+Y8='
WHERE
key_id = 'c935a7497e955f02429ba74b8e46617d21989bfc06eb2edd84c7233ae81072d8'
AND (
token = 'FfnTXAXvhHu5fcQtT+6vJ+mdQERoole2WYKdLLvF+Y8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)