UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4+lqnXdrVLNqSFuEENukgjOuIUOG6o3wi+1YiyqsgG0=' 
WHERE 
  key_id = 'f6bd31a6cc83234ace833c20a6ad4d414615ac348a697294a9d60b8796e8f8ac' 
  AND (
    token = '4+lqnXdrVLNqSFuEENukgjOuIUOG6o3wi+1YiyqsgG0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040