UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l70aAXD08yqoKkVULAt3cozszLLGW0lubtQOh4SDs9o=' 
WHERE 
  key_id = '40919558c3dd4185a9584c2c7c4a884c4f6f68770f8aa727e857b732d06c2771' 
  AND (
    token = 'l70aAXD08yqoKkVULAt3cozszLLGW0lubtQOh4SDs9o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031